export Tumor=$1
export Normal=$2
export config_file=$3
export cpu=$4

source ${config_file}


##############################################################
## 定义输出的文件夹

vcf_qc_tmp_path=${vcf_qc_path}/tmp/${Tumor}_${Normal}
mkdir -p ${vcf_qc_tmp_path}

##############################################################
## 文件的头行注释
echo "POS,Tumor_counts,Normal_counts,Tumor_alt_counts,Normal_alt_counts,alt_vaf_normal,DistanceToAlignmentEndMedian,DistanceToAlignmentEndMAD,minmapqualitydifference_TumorAltNormalRef,medianmapquality_Tumor,medianmapquality_altTumor,medianmapquality_Normal,median_quality_Tumor_alt,median_quality_Tumor_ref,median_quality_Normal_ref,zeroproportion_Tumor,zeroproportion_Normal,strandbiasprop,strandbiassimple" \
> ${vcf_qc_path}/${Tumor}_${Normal}_MutQc.csv


##############################################################
## 开始质控
cat ${vcf_path}/${Tumor}_${Normal}_PASS.vcf | grep -v "#" | awk -F'\t' '{OFS=":"}{print $1,$2,$4,$5}' | xargs -P ${cpu} -i sh -c '
sh ${dna_preprocess_scripts}/mutect2_Scripts/GATK4_SomaticVariant_Qc_Step.sh ${Tumor} ${Normal} {} ${config_file} 
' 
